add input validation in backend