fix cache generation (fix #39)

@tfoote Please review.