fix compositor leaks and more
misc. refactoring