working copy with bug fixes