fixed some bugs

- fixed the validation issue
- able to read from the database
- able to write to the database
- other minor tweaks