Fixes from debugging royston