added bounds check
added conversion failure test case