Fixed a few small bugs