Fixed all logging and runtime errors