better ami handling