fixing issue where last, first patterns were not working, which was due to a space that was added to the last first reverse method