fixed a bug with too long of a pattern, added tests for reset functions.
Merge remote-tracking branch 'origin/master' into mb