Fixed off-by-one error when checking for end of turn