Fix for Previous and Next Block.

I couldn't get rbsec's version of the code to work on my test site, so I made a fix myself.