Trying to fix #1038 and #1039