fixed a loop upon first run