improve database export script