Fixed the bug of the algorithm...

- now counting works... it was an unitialized cicle variable