Added AFlat and build fixes