Corrected a bug with the min heap remove algorithm

Signed-off-by: Martin Evans <martindevans@gmail.com>