fix library removal code