Check type for r.error
Refactor coercion to bool
Merge origin/master master