bugfixes, buy almost working