fix #271 & eliminate 2 compiler warnings in OSX