Fixed issue where reverse was used instead of return in encode.