minor source and edge case cleanup 

here are a few fixes from a brief review. i'll mention more concerns on the bug-wget mailing list.  thanks for breaking this out, Tim.