Fixed bugs in pooling layer and add testing