Fixed bug with wrong building ast for afs