fixed return value in case of error