added custom error messages (fixed existing implementation)