Fix #270 and #271