Closes #1267 and #1236