(DRAFT) Fixed engine bugs