Fixed compatibility issues with swift 1.0