take returncode into account