Improve accessors and fix bugs