Fixed db error and added modal