fixed checkFields to return error