fix caching of styles

If you choose to go with option 2 that I listed in #32, this is the PR.
@SBoudrias I stand corrected :-)