Use context members where available
Fix error message
Add logging