Fix some random bugs