Added more diagnostic checks to solver and fixed yet another a ctype bug