This adds some fixes but I'm not super confident of the changes due to 2 reasons:
I've not tested it thoroughly, I've only tested it via some additional non-related changes to this file
Some design decisions I made: using posix system calls instead of splitfs calls in order to avoid logging it again. But I think we need to ensure persistence in this case which I have not done currently in the PR
This adds some fixes but I'm not super confident of the changes due to 2 reasons: