fix bug when hooks aplied twice