Fixed some random bugs