Fixed bugs

Fixed some resource loading bugs, but it still doesn't render well
images and fonts.