minor modification: change Exception to sys.error and use scala 2.10 string substitution