Don't crash when there's no proxy set

Fixes #3
Replaces #4: also handles null proxy host without extra commits