added test for selector and fixed timeout functions