avoid cd at the end - it gives the wrong code.