Minor Python bug fixes