fix initialization bugs of factorgraph stuffs

@karlnapf, @iglesias: Please check if the bugs are fixed! I learn the issues from here: 
https://github.com/shogun-toolbox/shogun/commit/c784964444b2b046da9bc359cd953f5753407906