bugfixing and typefixing, editing errorchecking code