added mounted check and component event cleanup