fixed bugs, introduced cut operator (no backtracking)