error handling for weird bug