bug fixes - input validation