merged some changes and updated a bug concerning shared_ptr to a cimg