fix problem with const pointer to non const ptr