improved post-command-function