I have no idea how to use your solution, but...
This is what I did:
Spawn - is spawning allowed? this waits untill there are no enemies left.
enemycount - checks how many enemies have been counted
cenemycurrent - checks how many enemies are alive
checknumber - checks if checking of enemy current is in progress, if it is it stops it from looping.
It works perfectly so far, enemies do not stack on each other.