fixes to dump script

allow PG_OPT to be null
check for interactive using tty