proper handling of system sleep event