Added catching exception to get_replacement

Also handles constant values.