Bug fixes
(cherry picked from commit 0692c2211dfcc92b3381544fc1f064185d9b4aeb)

Conflicts:
	.travis.yml
Tests
Bug fix
Merge pull request #1077 from sjinks/bag-crash

Bug fix
Fixing warnings and preg_match new parameter
Merge remote-tracking branch 'upstream/1.3.0' into valgrind

Conflicts:
	.travis.yml