Strip debugging code and fix some stuff