Fix for issue #419

This pull request fixes issue #419.

The implementation is not optimal as it removes the implicit conversion operator from MSVC builds. Conversions to boost::optional<uint16_t> should therefore done explicitly from here on.