error fixes

need to check stability