fix exception bugs