Handle 501 -- Not Implemented.
Fix bug when connection was closed.
Cosmetic.
Fix variable name.