Fixed some bugs in BasicSolver
    While checking for constraint satisfaction, the reference was
    hard-coded as constraint.query().pattern().lhs().toString().
    This has been replaced with something more appropriate.

    Null definitions were being added to the restricted backtracking
    set of definitions. This would occur when a definition was not
    present in any of the Hierarchy levels. Added null check.