Handling of back and home button