CRA-509 Some bug fixes
CRA-510, CRA-511: Added more consistency checks, removed warnings.