updated python port, fixed bugs