do not call afterAction() if beforeAction returned false

fixes #5379