Handeling some possible errors