handled more possible errors