Fixed some bugs with replay