Fixed bugs on Windows due to stdin and stdout opened in text mode instead of binary mode. Also fixed wrong type of data for file descriptor selection  (was dictionary instead of tuple).