adding checkSolutionConsistency function; fixing multiple bugs all around -__-