added py2.4 compatibility