fix for scipy matrices