fix some add delete bugs that caused it to crash didnt use reference in passing data before