exception handling and log optimisations