Strict type checking in ToSql

cc #14