Fixed npe. Fixed bug in expand when not expandable