diff --git a/doc/changelog.rst b/doc/changelog.rst
index 543978002865b43afc475a1052bbfb983e238ab7..c47bd4d4e97b02b4a9b350cd0e27eaaff774e7f1 100644
--- a/doc/changelog.rst
+++ b/doc/changelog.rst
@@ -6,6 +6,7 @@ unreleased
 
 - **Bug fixes**
 
+    - fix :issue:`61` regarding sign of XAS in some cases :mr:`207`
 
 - **Improvements**
 
diff --git a/src/toolbox_scs/routines/XAS.py b/src/toolbox_scs/routines/XAS.py
index 0f483c5439113540b1dedff90982930dbf3c9a45..63c34c206188fc770cd9fa1f635186d62d41ca72 100644
--- a/src/toolbox_scs/routines/XAS.py
+++ b/src/toolbox_scs/routines/XAS.py
@@ -174,19 +174,12 @@ def xas(nrun, bins=None, Iokey='SCS_SA3', Itkey='MCP3peaks', nrjkey='nrj',
         """ Select which fields to use as I0 and which to use as I1
         """
 
-        if 'mcp' in Iokey.lower():
-            Io_sign = -1
-        else:
-            Io_sign = 1
-
-        if 'mcp' in Itkey.lower():
-            It_sign = -1
-        else:
-            It_sign = 1
-
         if len(data) == 0:
             return absorption([], [], fluorescence)
         else:
+            Io_sign = np.sign(np.nanmean(data['Io']))
+            It_sign = np.sign(np.nanmean(data['It']))
+            
             return absorption(It_sign*data['It'], Io_sign*data['Io'],
                               fluorescence)