latest changes and some fixes