fixing local variables in decomposition function