Update Python wrappers, fix a few bugs