Fixed another set of bugs, seems to be working now