Fix use of shift_opt and head_opt. (update to latest master)