Some fixes for commit 6dabf507814520.