fix reference handling, correctly switch targets

Resolves failing updates to cached reference sequence.  These generated "alt is
the same as the ref" type errors, and monomorphic calls in the VCF.  They also
could generate spurious haplotype calls.  Also affected by this change were
"subsequence of zero length or negative offset" errors.  Bounds checking is now
integrated into the routines in Fasta.cpp, and out-of-bounds returns the null
string instead of blowing up.

When processing entire BAM files, rather than targets or specified regions,
freebayes would wait for the condition that there were no more alignments in
order to switch targets.  This would cause problems specifically when 1) an
alignment reached the end of a sequence, 2) there were still more alignments,
3) no targets were specified.  A clarification of the position and target
switching logic resolves this issue.