fixed setInterval function creation