fix undefined input error