fix loops