workaround numpy.mean() version without keepdims

This is a workaround for older numpys whose mean() function does not
have the keepdims keyword option.

Closes #26.