fixed AMD bug; still uncorrect output