fixed bug in puzzle method