bugfixes... seems to work