revert bunch of last commits (thread issue was intoduced)