fixed some random bugs