Bugs 1287, 1257

https://redmine.openinfosecfoundation.org/issues/1287
https://redmine.openinfosecfoundation.org/issues/1257

Prscript:
- PR build: https://buildbot.openinfosecfoundation.org/builders/inliniac/builds/26
- PR pcaps: https://buildbot.openinfosecfoundation.org/builders/inliniac-pcap/builds/26

cc: @pjgofran