Fixes from Kirill