worked on fixing #340