refactored create/drop database
prevent JSONification of cyclic objects
fixed small memleak