removed get_db and g.db, defined pickle manually