contract api work
contact query bug fix and additional tests.