added get_fields to database library
updated model library, fixed some bugs