Correctly check conversion failure, it was not valid in C++11