replace die with error
modified schema with proper variables