fixed loop closing