SPARK-738 (branch 0.7 backport) Fixing nonserializable exception bug