Fixed settimeout to call function