important buggfix

most vital changes done