fix quoting and simplify upstream reference check

Closes #19