code generation bug fixes, dynamic function return type