remove double test and fix stash_spec
simplify subroutine hooking