Fixed a few small bugs that was preventing it from running