tested old cas support fix and small code improvement