Fixed all sorts of nasties