fixed printing issue when function returns None