Type error for function main