make sure path is valid