Cleanup control and parser threads handling. Might fix #917