merged fixes from konstantint-master