added better error codes.