minor bugfix and cleanup