fixing data access bugs, wrapping our app checks in a begin/resuce block