fix undefined value access