Improve validation check