Fixed stdin end event never being called, kind of dirty