fixed write issues with tornado