check if applocation_pool_* is defined

and a bugfix