Fix various errors