stabilize code from Alten