foreach to for

Foreach was giving troubles if the array was empty.
Merge branch 'master' of github.com:scientia-est-potentia/tickachu