Fixed auto-beaming edge case. Added a test to cover case.