Fixes first part of #1308