view model and SQLlite fixes