fixed validity bug