add valid check in render method