modified scaling a little bit to be more inclusive to older builds of numpy