Proper block-replacement checks. Fixes #3.