Fixed noncontiguous update problem and added tests