Back button logic fixes. Fixes #13