Moved debug checking and JIT code around into more appropriate places.