Fixing some weird bugs