Test

Backport various commits off master for a 3.0.4.