Fix bug when surface was hidden