added hooks, fixed clone bug