python2/python3 compatibility added