Handeling errors properly