fixing some random bugs