Fix wrong error messages and wrong return value