fixed slice overwrite bug