Fix various compile errors, add finally