Domain error catching added