Fixing a minor bug with predict function