GD error catching

This actually comes from @odcinek based on his BM changes
but it didn't get committed yesterday.