switched db driver from sql to pg + minor fixes