That should be if (limit and... ). Will fix it.