Fixes various errors