added check for empty repository
small fixes