fixed bug where std == 0, norm fails