fixing #591 again looks like it got overwritter by merge