fixed issue with inserting $$hashkey into database json, small changes
to templates