moved set -x to below redirection to stdout