The present invention relates to a detection device (6) for detecting photons emitted by a radiation source (2). The detection device (6) is configured to detect the photons during a first time period. The detection device (6) comprises a sensor (10) having an intermediate direct conversion material for converting photons into electrons and holes, a shaping element (20), and a compensation unit (450, INT, 950). The compensation unit (450, INT, 950) is adapted to provide a compensation signal based on the electrical pulse and on a photoconductive gain of said sensor (10). The core of the invention is to provide circuits to reduce artifacts due to inherent errors with direct conversion detectors in spectral computed tomography by determining a compensation current, by detecting or monitoring a baseline restorer feedback signal, or by ignoring signals above the baseline level.