Fixed #204 and added logging to hopefully further identify and fix the underlying problem