Added some random bug fixes