REFACTOR: errors in crypto