bugfix: the "pool" variable was not declared as "local".