Substring method fix