modified to check without buffer