add timeout to postgres connection, refs #127

and fixes potential unicode error found during testing