Fixed the resource system and started unbugging the scripting api