Fix error message on invalid receipt
Improve frame stack and add test