Various bug fixes for v3.1.0-beta