changes to work on python 2.5. not finished yet, json must be removed too.