Fix various issues and broken test (STOX-22)