Several python fixes in syntax and visual processing