modify rat.py for cross-platform