Merged and modified PR #1610. Added test for using promises in validations, thanks to @callumacrae