Fixing various errors