init code from apache websh project