Center problem with characteristic directions and inverse integrating factors