fix global 'gd' this time for good