Fixed exception with taking the mean of a patch. Currently returning 0 when an exception occurs. Shouldn't really matter