fixed q=None bug, updating syntax for python 3