fixed mode bugs (generated in the last merge)