added errors and reflection