some fixes

Im recreated fork, so now its better. see commit coments for details.
careful with last commit #51d4f336670ae52e5b779558f0449276bfb49eaf