Prevent some bugs when headers are nills. Also some style fixes