Fix counter rpc
Implements issue #66 (closed). Fixes a quirk in the RPC returning the counter of a given contract, which returns the next global counter if the counter is null, and can't be used to check whether an account is allocated or not.
re-opened from !121 (merged)
Edited by Tomáš Zemanovič