fixed issue 1393, cast_keys in dict for python 2.5 support, thanks Alan and Niphlod