Flags -p and -pr fails if pattern match no files

Fixes #851