Fix database code.

- Address all fabric api functions correctly
- Remove incorrect directory change