Fixes almost all bas tests except test 17. Needs more debugging stuff. These fixes will be temporary (will be deleted in next deliverables)