Fixed logging script