Fixed bug with tail encryption
Added missing test for a return value