patches and minor modifications