Fix usage of end