This gist is a workaround to this bug:
https://code.google.com/p/android/issues/detail?id=29472
No changes are needed to your current code but changing the extended fragment/activity class.
All you have to do is put this two classes in your code and make your activity extend MenuManagerActivity and your fragment MenuDelegatorFragment. If you are using Nested fragment you must make sure that all fragments containing nested Fragments with options menu also extend MenuDelegatorFragment (both if the parent fragment need an option menu both if it doesn't need it).