Resolve #614: Fix dumb bug causing infinite loop