Fix branch switch on hook