Fixing most obvious bugs.