BZ-1031306: fixing NPE for puzzle HARD 1
(cherry picked from commit 4684c4aa95cf4278d514194e63478b0262b52f55)
BZ-1031306: fixing NPE for puzzle HARD 4
(cherry picked from commit cdc587d1173951ae13cb871b5cdc9b72bf4ee5f1)