Fixed bug in original code, conversion to/from boolean