tweak code to handle safari race conditions and logging in properly