Some sneaky bugs fixed