av: Various fixes and cleanups

Change-Id: I82225d8cd3e2b3015e6c0e1dd9ddc5ec8abab525