Fix AMD support. Tested with both builds, optimised and unoptimised.

Fix for #238.