Make HTTP handling a bit more robust