try to fix undefined index errors