Fixes for singular matrices