fixed empty pattern bug