Fixed logic error with checking result limit