Various bug fixes, make independent of systematic