Fix a small bug in king safety