Use monkeypatching for time-travelling if possible

Fix #441