Fixed few issues in user dashboard views. Minor refactor in pgdb.scm