Fixed print function

Changes in Python 3
Fixed bugs