Fixing the predict function