Fixed a loop in the backend