fixed the shift case of singular matrix