Yet again better error handling (hopefully)