fixing various issues; this works on OSX 10.9.5