fix exception message when check input formats

Change "$to" to "$from" in exception message