Updated creditional check to return 400 error code