Add better error handling to AMD