slight fix on loop but *a++; problem remains