Added check before running slots function to prevent errors when code is not properly set