Fixed logging bugs