Fix false -1 return code being always true no matter what