bugfix, some improvements