proper copying and some debugging