added plotting option and fixes