Fixed memory leaks in Observer class