first block copying implementation
fix memory overwrite bug