added copy to memory function and redefined native types