added funcitonality to remove records with wrong number of aps