Fixes bugs related to #1669