Fixed a few errors caught by Pierpaolo.