added non-polymorphic version of writeBand