ChEngine.graphics() optimization and bug fix