Fix memory issues in desktop widget