Fixing some global pointer errors