Fixed a bug with window visability