Bug fix for chain mapping