updated validation middleware