WIP fixing before/after hooks

Change-Id: I5ebd5bab0a6b5ea5e4703dcf5dd922da1bf958a0