added assertion for clearer error, close #250