fixed some bugs that prevented saving and binding events