AMD compatibility

Original issue #327.