trying to fix undefined error