improve error message on panic