fixed db error + minor changes