undefined index cleanup fix