new version with some fixes