Fix Max pooling layer to use a mask

Now it uses a mask instead of relying on the data to back propagate the gradients.