Fixed some bugs with prediction method