Minor fixes and one extra check for the sake of it

Minor fixes and one extra check for the sake of it