fixed bug in rpicing that over wrote the main db