fix exception when input is undefined