Fix for issues #242 #178