Fixing some minor bugs