fixed bug with undefined