Fix maximize window

Sends error "Uncaught TypeError: Cannot read property 'position' of undefined", when clicking maximize button