Trying to fix undefined issue