Implementing suggestion https://github.com/casadi/casadi/commit/00ac43cf72f2389052f0d8a128736ddaf90a7741#commitcomment-2452710