Fixes

Some fixes for bugs raised by faenil.