added input check