Fixed crash for unimplemented elemwise gradient

This bug was reported by Michael McNeil Forbes on the mailing-list.