Another bugfix and additional logging