another logic problem