fixed bug in generateA