fixed a bug not checking for nil in validation