Fixed various bugs with python port, works with StudyCentric now.