bugfixes and ran it for first time

looks ok, needs some further testing
should work now