more correct setAdapter handling

setAdapter should handle adapter being null, and unregister dataset observers