Modified the exception throws for easier debugging