added onstop method