Fix #31: Check GD function existence before using it