fix bug with undefined input