Some debugging may be in order. Add a breakpoint to your code and step through it line by line, inspecting the vars and code execution along the way. When you spot something unexpected, update your question with that info and also include the specific line that’s crashing.
Also, the code is a bit incomplete so we don’t really know what’s being called or in what order.
Thanks Jay, after further investigation, i just figure out the cause of the issue. The issue comes when i try to access the expense object after i deleted it. So I just assign the properties i needed before deleting the object. thanks