minor changes, fixed exception