Fixed issue when buffer == null