Bugfixes in basic block refactor