Fixed some issues with the king func

It works almost right
it works better, but noy yet