check window first