Small bug in kirupa gallery tutorial

small bug in the kirupa gallery tutorial.
when you click several times on the next button very fast, the counter isn’t counting. and the wrong picture is shown. but when you click on the back button fast it works correctly.

anyone who can solve this.
or give me a hint to solve it because i can’t find the solution.

you can find the tut here: