call setAttributes only if array not empty
move request creation from bootstrap
add unit test stub
restore old error and exception handlers
clean up