I'm sorry, after 1 hour I found the mistake. I ran it step by step, and it ran out of bounds the for cycle. Thanks anyway!