Issue 598 fix

Patch to resolve most of issue #598. In particular cases 2 & 3 where the schema is set by .setSchema() and no schema is present in the datasource url.