Fixed various bug on AMD