Fixed ST3/Python 3 compatibility issues.

This should make the plugin work for both ST2 and ST3, but I don't know much Python so feel free to investigate further.