Added check for invalid requests