Bug fix for GEM