Fix requests

This includes both @retornam's changes and mine. This supercedes pull request #19.