small fixes + works on py2.6.6