Bugfixes nd errors fixed