fix undefined cases