Fix really bogus casting of a block number to a long.  Also change the comparison from a "< 0" to "== -1" like it should be.
Fix really bogus casting of a block number to a long.  Also change the
comparison from a "< 0" to "== -1" like it should be.

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase