fixes to create hstore, still work to do, added tests for writing to database