Merging Karl's fixes