Major bug fixes including ko checks (took forever)