fixed bugs of python code by earthsea