undefined error fixed