undefined returned value solved