fix bugs in amp version, still working