fixed pooling code and tests