Fixes the error with the settimeout