Fix race condition in selectFrameToSend
Correct initial window size
Fix blocking issues in frame handling

Thanks to cpg for the fix