refactored str_to_bool to to_bool