counter was in a function and not accessable