Fix logging in script