check block.nil? instead of block_given?