fix a leak; add a todo about handling resume from sleep