not sure if fillmode is being honored
scripted update of code from master at f139784 not sure if fillmode is being honored