fix ami script