fixed several issues and added some optimization to rendering
updated mario example