fix return type bug for non primitive types