Some fixes related to surface management and window resizing