fixed some of the buggs found during test, further test awaits