added test and fixed a validation error