some fixes

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