Added debug messages to getNextBlockNumber