Fixes #172.
Added backtracking tests related to issue #172.