Fix return value and error message