changed exception message
adjusted context managers