Fixed bug in RMT code