Fixes to prevent crash before log is outputed