modified to support Xcode5 and 64-bit architectures