Fix return type checking