Fixed bugs in window:focus() and application:activate()