Fixed some undefined variables when using forced updates

Fixed some undefined variables ($readable and $localts) when using
forced updates.
Fix for bug #5 (some devices not detected)

This was a general bug in the pattern hash handling, so that the
detection could fail in some special cases (for patterns that use a ? or
* placeholder in the first 32 characters and before a space). I also
fixed a possible bug that could lead to unnecessary cache file
regeneration.
update from the master branch