fix conversion between NSRect and CGRect