added cache to speed up spark example
bug fix