beamer fix based on http://stackoverflow.com/a/13020592/2022326