remove invalid keys