fixed bug with logging