Bug fixes in expandPanel