fixing runtime errors and casing out a few unity specific calls