Several fixes from code sprint