having issues with undefined