removed the last char using rtrim function