Fixing some strange bugs