Fix PollingTransport problems

This patch fixed some problems with XHRPollingTransport.
Could also fix Issue #153.