fixed python 2.4 compatible code