fix to do lock internal data on flush
update gemspec style