fix row removal code